package cn.com.reflect;

import cn.com.domain.Person;

public class ReFlectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException {
        //1. 全类名
        Class cls1 = Class.forName("domain.Person");
        System.out.println(cls1); //class domain.Person
        //2. 类名.class
        Class cls2 = Person.class;
        System.out.println(cls2); //class domain.Person
        //3. 对象.getClass()
        Person person = new Person();
        Class cls3 = person.getClass();
        System.out.println(cls3);
        //比较三个对象
        System.out.println(cls1 == cls2); // true
        System.out.println(cls2 == cls3); // true
        System.out.println(cls1 == cls3); // true

       // Class cls = Class.forName()
    }
}
